package cc.sunni.api.controller.article;

import cc.sunni.common.utils.R;
import cc.sunni.pojo.bo.CommentReplyBO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@Api(value = "评论相关业务的controller", tags = {"评论相关业务的controller"})
@RequestMapping("comment")
public interface CommentControllerApi {

    @PostMapping("createComment")
    @ApiOperation(value = "用户评论", notes = "用户评论", httpMethod = "POST")
    R createArticle(@RequestBody @Validated CommentReplyBO commentReplyBO);

    @GetMapping("counts")
    @ApiOperation(value = "用户评论数查询", notes = "用户评论数查询", httpMethod = "GET")
    R commentCounts(@RequestParam String articleId);

    @GetMapping("list")
    @ApiOperation(value = "查询文章的所有评论列表", notes = "查询文章的所有评论列表", httpMethod = "GET")
    R list(@RequestParam String articleId,
           @RequestParam(value = "page", required = false, defaultValue = "1") Integer page,
           @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize);

    @PostMapping("mng")
    @ApiOperation(value = "查询我的评论管理列表", notes = "查询我的评论管理列表", httpMethod = "POST")
    R mng(@RequestParam String writerId,
          @ApiParam(name = "page", value = "查询下一页的第几页")
          @RequestParam(value = "page", required = false, defaultValue = "1") Integer page,
          @ApiParam(name = "pageSize", value = "分页的每一页显示的条数")
          @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize);


    @PostMapping("/delete")
    @ApiOperation(value = "作者删除评论", notes = "作者删除评论", httpMethod = "POST")
    R delete(@RequestParam String writerId, @RequestParam String commentId);
}
